/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Author:
 *     coolair.loveU2@gmail.com
 *******************************************************************************/

package org.skyfree.ghyll.tcard.core;



/**
 * This class ...
 */

public class StoragePath implements IStoragePath
{
	private static String REPOSITORY = "/Repository";
	private static String WORKSPACE = "/WorkSpace";
	private static String SEP = "/";
	/**
	 * The storagePath object for Repository.
	 */
	public static IStoragePath RES = new  StoragePath(REPOSITORY);
	/**
	 * THe storagePath object for WorkSpace.
	 */
	public static IStoragePath WS = new  StoragePath(WORKSPACE);
	
	private String path = null;
	
	public StoragePath(String path)
	{
		this.path = path;
	}
	@Override
	public String getPath()
	{
		return this.path;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object getAdapter(Class adapter)
	{
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public boolean equals(Object obj)
	{
		if(obj instanceof IStoragePath)
		{
			IStoragePath target = (IStoragePath)obj;
			return this.path.equals(target.getPath());
		}
		return false;
	}
	@Override
	public String toString()
	{
		return "TPath:"+this.path;
	}
	@Override
	public IStoragePath append(String sub)
	{
		return new StoragePath(this.path+SEP+sub);
	}
	
}
